//
//  LSNavBar.swift
//  LSWeibo1
//
//  Created by 李明禄 on 2018/12/6.
//  Copyright © 2018 SocererGroup. All rights reserved.
//

import UIKit

class LSNavBar: UINavigationBar {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        for subview in subviews {
            let subName = NSStringFromClass(subview.classForCoder)
            if subName == "_UIBarBackground" {
                subview.frame = bounds
            }else if subName == "_UINavigationBarContentView" {
                var frame = subview.frame;
                frame.origin.y = UIViewController().isNotchScreen ? 44 : 20
                frame.size.height = self.bounds.size.height - frame.origin.y;
                subview.frame = frame;
            }
        }
    }

}
